<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org"  xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">
<head th:include="centre/manage/include :: header"></head>
<body class="gray-bg">
	<div class="wrapper wrapper-content animated fadeInRight">
		<div class="row">
			<div class="col-sm-12">
				<div class="ibox float-e-margins">
					<div class="ibox-title">
						<h5>分类添加</h5>
					</div>
					<div class="ibox-content">
						<form class="form-horizontal m-t" id="categoryAddForm">
							<div class="form-group">
								<label class="col-sm-3 control-label">排序:</label>
								<div class="col-sm-8">
									<input id="displayorder" name="displayorder"
										class="form-control" type="text">
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">分类名称:</label>
								<div class="col-sm-8">
									<input id="name" name="name" class="form-control" type="text">
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">商品分类:</label>
								<div class="col-sm-8">
									<select data-placeholder="" class="form-control chosen-select"
										tabindex="30" id="parentid" name="parentid">
										<option th:value="0">----</option>
										<option th:each="item: ${baTypes}" th:text="${item.name}"
											th:value="${item.id}"></option>
									</select>
								</div>
							</div>

							<div class="form-group">
								<label class="col-sm-3 control-label">商品类别:</label>
								<div class="col-sm-8">
									<select data-placeholder="" class="form-control chosen-select"
											tabindex="30" id="productGradeId" name="productGradeId">
										<option value="">---请选择---</option>
										<option th:each="item: ${productGrades}" th:text="${item.name}"
												th:value="${item.id}"></option>
									</select>
								</div>
							</div>

                           <input type="hidden" id="centreId"  name="centreId" th:value="${centreId}" th:if="${flag} == '1'">
							<div class="form-group" th:if="${flag} == '0'">
								<label class="col-sm-3 control-label">商户:</label>
								<div class="col-sm-8">
									<select name="centreId" id="centreId"  class="form-control"  onchange="getCentreNmae()">
									  <option value="">--请选择--</option>
										<option th:each="item: ${centreList}" th:text="${item.name}" th:value="${item.centreId}"></option>
									</select>
								</div>
							</div>
							<input type="hidden" id="teamId" th:value="${teamId}">
							<div class="form-group" th:if="${teamId == null}">
								<label class="col-sm-2 control-label"><em class="gg-star" style="margin-right: 7px">*</em>选择门店:</label>
								<div class="col-sm-8">
									<select data-placeholder="" class="form-control chosen-select"
											id="liansuoId"
											name="liansuoId">
										<option value="0">选择门店</option>
										<option th:each="item: ${teams}" th:text="${item.tXiaoqu+ +item.id}"
												th:value="${item.id}"></option>
									</select>
								</div>
							</div>
                            <input type="hidden" name="centreName" id="centreName"/>
							<!-- <input type="hidden" name="centreId" th:value="${centreId}"
								th:if="${flag} == '1'"> -->

							<div class="form-group">
								<label class="col-sm-3 control-label">分类图片:</label>
								<div class="col-sm-6">
									<input id="thumb" name="thumb" class="form-control" type="text"
										onblur="onThumbBlur()">
								</div>
								<div class="col-sm-2">
									<button type="button"
										onclick="onSelectImgBtnClick('thumb','thumbImg')"
										class="btn btn-primary">
										<i class="fa fa-check"></i>选择图片
									</button>
								</div>
							</div>
							<div class="form-group">
								<div class="col-sm-8">
									<label class="col-sm-5 control-label"></label> <img
										class="img-responsive" id="categoryAddthumbImg" src=""
										style="max-width: 30%">
								</div>
							</div>

							<div class="form-group">
								<label class="col-sm-3 control-label"><em class="gg-star" style="margin-right: 7px">*</em>类型</label>
								<div class="col-sm-8">
									<select data-placeholder="" class="form-control chosen-select"
										tabindex="30" id="type" name="type">
										<option value="0">-请选择-</option>
<!--										<option value="1">活动类目</option>-->
<!--										<option value="2">前台类目</option>-->
<!--										<option value="3">后台类目</option>-->
										<option value="4">主页类目</option>
										<option value="5">外卖类目</option>
<!--										<option value="6">堂食类目</option>-->
<!--										<option value="7">自提类目</option>-->
									</select>
								</div>
							</div>
							
							<div class="form-group">
								<label class="col-sm-3 control-label">列表显示:</label>
								<div class="col-sm-8">
									<select data-placeholder="" class="form-control chosen-select"
										tabindex="30" id="isList" name="isList">
										<option value="0" selected>在列表显示</option>
										<option value="1">不在列表显示</option>
									</select>
								</div>
							</div>
							
							<div class="form-group">
								<label class="col-sm-3 control-label">分类描述:</label>
								<div class="col-sm-8">
									<textarea id="description" name="description"
										class="form-control" /></textarea>
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">是否显示:</label>
								<div class="col-sm-8">
									<!-- <div class="switch" data-on="success" data-off="warning">
										<input type="checkbox" id="enabled" name="enabled"
											checked="checked" value="1"
											onclick="this.value=this.checked?1:0" />
									</div> -->
									<div class="onoffswitch">
										<input type="checkbox" class="onoffswitch-checkbox" value="1"
											checked="checked" id="enabled" name="enabled"
											onclick="alert(this.value=this.checked?1:0)"> 
											<label class="onoffswitch-label" for="enabled"> 
											<span class="onoffswitch-inner"></span> 
											<span class="onoffswitch-switch"></span>
										</label>
									</div>
								</div>
							</div>

							<div class="form-group">
								<label class="col-sm-3 control-label">分类是否可打折:</label>
								<div class="col-sm-8">
									<label class="radio-inline">
										<input type="radio" name="discountStatus" value="1"/>是
									</label>
									&nbsp;&nbsp;&nbsp;&nbsp;
									<label class="radio-inline">
										<input type="radio" name="discountStatus" value="0"/>否
									</label>
								</div>
							</div>

							<div class="form-group">
								<label class="col-sm-3 control-label">折扣上限:</label>
								<div class="col-sm-8">
									<input type="text" name="discount" id="discount"
										   class="form-control" value="" />
								</div>
							</div>

							<div class="form-group text-center">
								<div class="col-sm-8 col-sm-offset-2">
									<button type="button" class="btn btn-primary" onclick="save()">
										<i class="fa fa-check"></i>提交
									</button>
									<div class="btn btn-danger" onclick="closeDow()">
										<i class="fa fa-remove"></i> 关闭
									</div>
								</div>
							</div>
						</form>
					</div>
				</div>
			</div>
		</div>
	</div>
	<div th:include="centre/manage/include::footer"></div>
	<script type="text/javascript" src="/js/appjs/category/add.js"></script>
	<script type="text/javascript">
		function closeDow() {
			var index = parent.layer.getFrameIndex(window.name); // 获取窗口索引
			parent.layer.close(index);
		}
	</script>
</body>
</html>
